//
//  StatementViewController.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/7/21.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "StatementViewController.h"
#import <WebKit/WebKit.h>
@interface StatementViewController ()<WKNavigationDelegate,WKUIDelegate>
@property(nonatomic,strong)UIWebView *webVeiw;
//@property(nonatomic,strong)WKWebView *webVeiw;
@end

@implementation StatementViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"用户许可协议";
    [self addBackBtn];
    [self loadWebViewData];
    
}
-(void)addBackBtn{
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake(0, 6, 67, 23);
    UIImageView *backImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navigator_btn_back"]];
    backImg.frame = CGRectMake(-10, 0, 22, 22);
    [backBtn addSubview:backImg];
    UILabel *backText = [[UILabel alloc] initWithFrame:CGRectMake(12, 0, 65, 22)];
//    backText.text = @"返回";
    backText.font = [UIFont systemFontOfSize:17];
    [backText setBackgroundColor:[UIColor clearColor]];
    [backText setTextColor:[UIColor whiteColor]];
    [backBtn addSubview:backText];
    [backBtn addTarget:self action:@selector(leftBarButtonItemPressed) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
    [self.navigationItem setLeftBarButtonItem:leftButton];
    self.title = @"用户许可协议";
}
-(void)loadWebViewData{
    self.webVeiw = [[UIWebView alloc] initWithFrame:CGRectMake(-WIDTH *0.2, 0, WIDTH *1.4, HEIGHT + 0)];
    [self.view addSubview:self.webVeiw];
    NSString *path1 = [[NSBundle mainBundle]pathForResource:@"1、服务条款的确认和接纳" ofType:@"doc"];
    NSURL *url = [NSURL fileURLWithPath:path1];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webVeiw loadRequest:request];
    _webVeiw.scalesPageToFit = YES;
}
//-(void)loadWebViewData{
//    self.webVeiw = [[WKWebView alloc] initWithFrame:CGRectMake(-WIDTH *0.2, 0, WIDTH *1.4,  HEIGHT )];
//    [self.view addSubview:self.webVeiw];
//    NSString *path1 = [[NSBundle mainBundle]pathForResource:@"1、服务条款的确认和接纳" ofType:@"doc"];
//    NSURL *url = [NSURL fileURLWithPath:path1];
//    NSURLRequest *request = [NSURLRequest requestWithURL:url];
//    [self.webVeiw loadRequest:request];
//}
-(void)leftBarButtonItemPressed{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}
@end
